<template>
  <div id="client">
    <p style="margin-left: 20px">
      <span class="demonstration" style="margin-left: 20px">单据日期：</span>
      <el-date-picker
        v-model="value2"
        type="daterange"
        align="right"
        unlink-panels
        range-separator="至"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
        :picker-options="pickerOptions"
      >
      </el-date-picker>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 客户类别：<el-select
        v-model="value"
        placeholder="客户类别"
        style="width: 120px"
      >
        <el-option
          v-for="item in options"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
      &nbsp;&nbsp;&nbsp;客户：<el-input
        style="width: 180px; margin-left: 10px; margin-right: 20px"
        placeholder="请选择"
        v-model="input"
        clearable
      ></el-input>
      <el-button
        style="margin-left: -20px; margin-right: 10px"
        @click="dialogFormVisible = true"
        >...</el-button
      >
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
      &nbsp;&nbsp;&nbsp;
      <el-button type="primary">查询</el-button>
      <el-divider style="width: 1500px"></el-divider>
    </p>
    <p style="text-align: center; margin-top: 20px; width: 100%">
      <span style="font-weight: bolder; font-size: 22px">销售利润表</span>
      <span style="display: inline-block; float: right; margin-right: 40px">
        <el-button>导出</el-button>
        <el-button>打印</el-button>
      </span>
    </p>
    <el-table :data="tableData" height="400" border style="width: 100%">
      <el-table-column prop="date" label="单据日期" width="120">
      </el-table-column>
      <el-table-column prop="name" label="客户" width="150px">
      </el-table-column>
      <el-table-column prop="clientaddress" label="客户地址" width="150px">
      </el-table-column>
      <el-table-column prop="saleman" label="销售人员" width="150px">
      </el-table-column>
      <el-table-column prop="doman" label="制单人" width="150px">
      </el-table-column>

      <el-table-column prop="id" label="单据编号" width="120">
      </el-table-column>
      <el-table-column prop="type" label="业务类别" width="150px">
      </el-table-column>
      <el-table-column prop="num" label="数量" width="150px"> </el-table-column>
      <el-table-column prop="discount" label="折扣率" width="150px">
      </el-table-column>
      <el-table-column prop="taxmoney" label="税额" width="150px">
      </el-table-column>

      <el-table-column prop="lastmoney" label="价税合计" width="150px">
      </el-table-column>
      <el-table-column prop="salemoney" label="销售成本" width="150px">
      </el-table-column>
      <el-table-column
        prop="salemaoli"
        label="销售毛利（销售收入-销售成本）"
        width="150px"
      >
      </el-table-column>
      <el-table-column
        prop="salemaolilv"
        label="毛利率（销售毛利/销售收入）"
        width="150px"
      >
      </el-table-column>
      <el-table-column prop="cheapermoney" label="优惠金额" width="150px">
      </el-table-column>
      <el-table-column prop="salefee" label="销售费用" width="150px">
      </el-table-column>
      <el-table-column
        prop="salejinglirun"
        label="销售净利润（销售毛利-优惠金额-销售费用）"
        width="150px"
      >
      </el-table-column>
      <el-table-column
        prop="jinglirate"
        label="净利率（销售净利润/销售收入）"
        width="150px"
      >
      </el-table-column>
      <el-table-column prop="lastcheapermoney" label="优惠后金额" width="150px">
      </el-table-column>
      <el-table-column prop="clientpaymoney" label="客户承担费用" width="150px">
      </el-table-column>
      <el-table-column prop="shouldmoney" label="应收金额" width="150px">
      </el-table-column>
      <el-table-column prop="havemoney" label="已收金额" width="150px">
      </el-table-column>
      <el-table-column prop="nomoney" label="未收金额" width="150px">
      </el-table-column>
      <el-table-column prop="text" label="备注" width="150px">
      </el-table-column>
    </el-table>
    <div style="width: 100%; background-color: blanchedalmond; height: 30px">
      <table style="width: 78.7%; height: 30px">
        <tr>
          <td style="width: 50%">合计：</td>
          <td style="width: 50%">123</td>
        </tr>
      </table>
    </div>
    <div class="block">
      <p style="text-align: center; margin-top: 10px">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage1"
          :page-sizes="[100, 200, 300, 400]"
          :page-size="100"
          layout="total, sizes, prev, pager, next, jumper"
          :total="400"
        >
        </el-pagination>
      </p>
    </div>
    <el-dialog top="20px" title="添加业务员" :visible.sync="dialogFormVisible">
      <el-input
        v-model="input"
        placeholder="请输入编号或名称"
        style="width: 200px; margin-left: 20px"
      ></el-input>
      <el-checkbox v-model="checked" style="margin-left: 20px"
        >显示禁用职员</el-checkbox
      >
      <el-button type="success" style="margin-left: 20px">查询</el-button>
      <el-table :data="gridData">
        <el-table-column type="selection" width="55"> </el-table-column>
        <el-table-column
          width="100"
          property="name"
          label="类别"
        ></el-table-column>
        <el-table-column
          width="100"
          property="address"
          label="编号"
        ></el-table-column>
        <el-table-column
          width="300"
          property="address"
          label="名称"
        ></el-table-column>
        <el-table-column
          width="100"
          property="address"
          label="联系人"
        ></el-table-column>
        <el-table-column
          width="100"
          property="address"
          label="手机"
        ></el-table-column>
        <el-table-column
          width="100"
          property="address"
          label="备注"
        ></el-table-column>
      </el-table>
      <div class="block">
        <span class="demonstration"></span>
        <el-pagination layout="prev, pager, next" :total="1000">
        </el-pagination>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false"
          >确 定</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      currentPage1: 5,
      dialogFormVisible: false,
      gridData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
      ],
      tableData: [
        {
          date: "2024-01-01",
          name: "客户A",
          clientaddress: "北京市朝阳区",
          saleman: "销售员1",
          doman: "张三",
          id: "001",
          type: "电子产品",
          num: 10,
          discount: 0.05,
          taxmoney: 300,
          lastmoney: 1500,
          salemoney: 1000,
          salemaoli: 500,
          salemaolilv: 0.333,
          cheapermoney: 100,
          salefee: 50,
          salejinglirun: 350,
          jinglirate: 0.233,
          lastcheapermoney: 1400,
          clientpaymoney: 200,
          shouldmoney: 1600,
          havemoney: 1000,
          nomoney: 600,
          text: "无特殊要求",
        },
        {
          date: "2024-01-02",
          name: "客户B",
          clientaddress: "上海市浦东新区",
          saleman: "销售员2",
          doman: "李四",
          id: "002",
          type: "日用品",
          num: 15,
          discount: 0.07,
          taxmoney: 350,
          lastmoney: 1800,
          salemoney: 1200,
          salemaoli: 600,
          salemaolilv: 0.333,
          cheapermoney: 150,
          salefee: 60,
          salejinglirun: 390,
          jinglirate: 0.217,
          lastcheapermoney: 1650,
          clientpaymoney: 250,
          shouldmoney: 1900,
          havemoney: 1300,
          nomoney: 600,
          text: "加急处理",
        },
        {
          date: "2024-01-03",
          name: "客户C",
          clientaddress: "广州市天河区",
          saleman: "销售员3",
          doman: "王五",
          id: "003",
          type: "食品",
          num: 8,
          discount: 0.06,
          taxmoney: 280,
          lastmoney: 1200,
          salemoney: 800,
          salemaoli: 400,
          salemaolilv: 0.333,
          cheapermoney: 120,
          salefee: 40,
          salejinglirun: 340,
          jinglirate: 0.283,
          lastcheapermoney: 1080,
          clientpaymoney: 180,
          shouldmoney: 1300,
          havemoney: 800,
          nomoney: 500,
          text: "注意包装",
        },
        {
          date: "2024-01-04",
          name: "客户D",
          clientaddress: "深圳市南山区",
          saleman: "销售员4",
          doman: "赵六",
          id: "004",
          type: "化妆品",
          num: 12,
          discount: 0.08,
          taxmoney: 400,
          lastmoney: 2000,
          salemoney: 1400,
          salemaoli: 600,
          salemaolilv: 0.3,
          cheapermoney: 180,
          salefee: 70,
          salejinglirun: 350,
          jinglirate: 0.175,
          lastcheapermoney: 1820,
          clientpaymoney: 300,
          shouldmoney: 2100,
          havemoney: 1400,
          nomoney: 700,
          text: "需开发票",
        },
        {
          date: "2024-01-05",
          name: "客户E",
          clientaddress: "杭州市西湖区",
          saleman: "销售员5",
          doman: "钱七",
          id: "005",
          type: "图书",
          num: 20,
          discount: 0.05,
          taxmoney: 250,
          lastmoney: 1000,
          salemoney: 700,
          salemaoli: 300,
          salemaolilv: 0.3,
          cheapermoney: 80,
          salefee: 30,
          salejinglirun: 190,
          jinglirate: 0.19,
          lastcheapermoney: 920,
          clientpaymoney: 150,
          shouldmoney: 1100,
          havemoney: 700,
          nomoney: 400,
          text: "节假日顺延",
        },
      ],
      dialogFormVisible: false,
      value2: "",
    };
  },
  methods: {
    goto(to) {
      if (this.$route.path !== "/" + to) {
        this.$router.push(to);
      }
    },
  },
};
</script>

<style scoped>
.el-button el-button--default el-popover__reference {
  margin-right: 20px;
}

tr {
  border: 1px solid black;
}
</style>